#include "stdafx.h"

#include "ResourceHandle.h"

#include "ResourceCache.h"

ResourceHandle::ResourceHandle(
	Resource& resource, 
	char* pBuffer, 
	unsigned int size, 
	ResourceCache* pResourceCache) : _resource(resource)
{
	_pBuffer = pBuffer;
	_size = size;
	_pResourceCache = pResourceCache;
}

//
// ResHandle::ResHandle							- Chapter 8, page 223
//
ResourceHandle::~ResourceHandle()
{
	SAFE_DELETE_ARRAY(_pBuffer);

	_pResourceCache->MemoryHasBeenFreed(_size);
}